﻿// -----------------------------------------------------------------------
// <copyright file="ImageDispenser.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace SurfaceInteraction.UI.Surface.Dispenser
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Windows.Controls;
    using System.Windows.Media.Imaging;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Windows;



    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class ImageDispenser
    {
        private readonly string imagesPath;
        private readonly ObservableCollection<string> imageList;
        private const string IMAGES_DIRECTORY = "Images";
        public ImageDispenser()
        {

            imageList = new ObservableCollection<string>();

            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()) == false)
            {
                imagesPath = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), IMAGES_DIRECTORY);

                if (Directory.Exists(imagesPath))
                {
                    foreach (string file in Directory.GetFiles(imagesPath, "*.jpg"))
                    {
                        imageList.Add(file);
                    }
                }
            }
        }

        public ObservableCollection<string> Images
        {
            get { return imageList; }
        }
    }
}
